package chapter1113;

import javax.swing.*;
import java.awt.*;

public class UIDemo {
    private Frame win;
    private Label label;
    private TextField textField;
    private JButton button1;
    private JButton button2;

    public UIDemo(){
        win = new MyFrame();
        label = new Label("Name:");
        textField = new TextField(20);
        button1 = new JButton("click");
        button2 = new JButton("点击");

//        win.add(label);
//        win.add(textField);
        win.add(button1);
        win.add(button2);

        button1.addActionListener(new A());
        button2.addActionListener(new B());

        win.setVisible(true); //这边不加会导致第一次打开窗口时无图标显示
//        button1.setPreferredSize(new Dimension(50, 50));
//        button2.setPreferredSize(new Dimension(50, 50));
    }
}
